﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Text;
using System.Windows.Forms;
using TRicheControl.DefaultControlStyles.Helper;
using TRicheControl.Interface.ControlStyle;

namespace TRicheControl.DefaultControlStyles
{
    public class TextBoxStyle : ITextBoxStyle
    {
        private Pen mEnableBoxBorderPen;
        private SolidBrush mEnableBoxBackGrounBrush;
        private int mCornerRadius = 3;

        public TextBoxStyle()
        {
            mEnableBoxBackGrounBrush = new SolidBrush(Color.White);
            mEnableBoxBorderPen = new Pen(Color.DarkGray);
        }

        public void DrawEnableBox(System.Drawing.Graphics g, System.Drawing.Rectangle rect)
        {
            g.DrawRectangle(new Pen(SystemColors.Control), rect);
            DrawHelper.DrawCornerBoxBorder(g, rect, mEnableBoxBorderPen, mCornerRadius);
        }

        public void DrawUnEnableBox(System.Drawing.Graphics g, System.Drawing.Rectangle rect)
        {
            DrawHelper.SetGraphics(g);
            g.DrawRectangle(new Pen(SystemColors.Control), rect);
            DrawHelper.DrawCornerBoxBorder(g, rect, mEnableBoxBorderPen, mCornerRadius);
        }

        public void DrawMouseEnterEnableBox(System.Drawing.Graphics g, System.Drawing.Rectangle rect)
        {
            DrawHelper.SetGraphics(g);
            g.DrawRectangle(new Pen(SystemColors.Control), rect);
            DrawHelper.DrawCornerBoxBorder(g, rect, mEnableBoxBorderPen, mCornerRadius);
        }

        public void DrawGotFouseEnableBox(System.Drawing.Graphics g, System.Drawing.Rectangle rect)
        {
            DrawHelper.SetGraphics(g);
            
            //g.FillPath(mEnableBoxBackGrounBrush, path);
            DrawHelper.DrawCornerBoxBorder(g, rect, mEnableBoxBorderPen, mCornerRadius);
        }

        public void DrawString(string str, System.Drawing.Font font, System.Drawing.Color strColor, System.Drawing.Graphics g, System.Drawing.Rectangle rect)
        {
            DrawHelper.SetGraphics(g);
            TextRenderer.DrawText(g, str, font, rect, strColor, TextFormatFlags.Left | TextFormatFlags.VerticalCenter);
        }

        public void DrawWatermark(string str, Font font, Graphics g, Rectangle rect)
        {
            StringFormat format = new StringFormat();
            format.Alignment = StringAlignment.Near;
            format.LineAlignment = StringAlignment.Center;
            if (font == null)
            {
                font = SystemFonts.CaptionFont;
            }
            g.DrawString(str, font, new SolidBrush(Color.DarkGray), rect, format);
        }

        public void DrawFouseStringBorder(System.Drawing.Graphics g, System.Drawing.Rectangle rect)
        {
            DrawHelper.SetGraphics(g);
        }

        public void DrawSelectString(string str, System.Drawing.Font font, System.Drawing.Color strColor, System.Drawing.Graphics g, System.Drawing.Rectangle rect)
        {
            DrawHelper.SetGraphics(g);
        }

        public void DrawBackColor(System.Drawing.Graphics g, System.Drawing.Rectangle rect, System.Drawing.Color color)
        {
            DrawHelper.SetGraphics(g);
        }

        

        public void DrawBackGroundImage(Graphics g, Image image, Rectangle rect, System.Windows.Forms.ImageLayout layout)
        {
            DrawHelper.SetGraphics(g);
        }
    }
}
